<?php

declare (strict_types=1);

namespace app\store\controller\agent;


use app\store\controller\Controller;
use think\App;
use think\response\Json;
use app\store\service\agent\Player as PlayerService;

/**
 * 玩家员管理
 * Class Setting
 * @package app\store\controller
 */
class Player extends Controller
{
    private $playerService;
    public function __construct(App $app,PlayerService $playerService)
    {
        parent::__construct($app);
        $this->playerService = $playerService;
    }

    /**
     * 玩家列表
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function list():Json
    {
        $params = $this->request->get();
        $this->validate(
            $params,
            [
                'page' => 'integer',
                'limit' => 'integer',
                'promoter_user_id|推广员用户ID' => 'integer',
                //'promoter_nick_name|推广员用户昵称' => '',
                'player_user_id|玩家用户id' => 'integer',
               // 'player_nick_name|玩家用户昵称' => ''
            ]
        );
        $list = $this->playerService->getList($params);
        return $this->renderSuccess(compact('list'));
    }



}
